/*
 * Copyright 2008 Andrej Herich
 * 
 * http://azetclient.yw.sk/
 * http://azetclient.googlecode.com/
 * 
 * This file is part of AzetClient.
 * 
 * AzetClient is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * AzetClient is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with AzetClient.  If not, see <http://www.gnu.org/licenses/>.
 */

package sk.yw.azetclient.managers;

import java.util.EventObject;

/**
 *
 * @author error216
 */
public class ConnectionManagerEvent extends EventObject {
    
    public enum Type { ERROR, AUTHENTICATION_SUCCEEDED, AUTHENTICATION_FAILED,
    MESSAGE_NOT_SENT }
    
    private Type type;
    private Object subject;
    
    public ConnectionManagerEvent(ConnectionManager source, Type type,
            Object subject) {
        super(source);
        this.type = type;
        this.subject = subject;
    }

    public Type getType() {
        return type;
    }

    /**
     * <table>
     *  <tr><th>ConnectionManagerEvent.Type</th><th>Class of subject</th></tr>
     *  <tr><td>ERROR</td>                      <td>java.lang.Throwable</td></tr>
     *  <tr><td>AUTHENTICATION_FAILED</td>      <td>null</td></tr>
     *  <tr><td>MESSAGE NOT SENT</td>           <td>sk.yw.azetclient.model.Message</td></tr>
     * </table>
     * 
     * @return subject of this event
     */
    public Object getSubject() {
        return subject;
    }

}
